import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import List from '@/views/List'
import News from '@/views/News'
import Profile from '@/views/Profile'
import Login from '@/views/Login'
import Favorate from '@/views/Favorate'
import Rent from '@/views/Rent'
import Publish from '@/views/Publish'
import Detail from '@/views/Detail'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/layout',
    component: Layout,
    children: [
      {
        path: '/home',
        component: Home
      },
      {
        path: '/home/list',
        component: List
      },
      {
        path: '/home/news',
        component: News
      },
      {
        path: '/home/profile',
        component: Profile
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/favorate',
    component: Favorate
  },
  {
    path: '/rent',
    component: Rent
  },
  {
    path: '/rent/publish',
    component: Publish
  },
  {
    path: '/detail/:id',
    component: Detail
  }
]

const router = new VueRouter({
  routes
})

export default router
